home *** CD-ROM | disk | FTP | other *** search
-
- // $VER: DirTree.h 2.00 (24-Apr-95) ©CM 1995
-
-
- #include <utility/hooks.h>
- #include <exec/memory.h>
- #include <dos/dos.h>
- #include <dos/exall.h>
- #include <exec/types.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
-
- //extern "C" {
- #include <clib/alib_protos.h>
- #include <pragma/dos_lib.h>
- #include <pragma/exec_lib.h>
- #include <pragma/utility_lib.h>
- //}
-
- #define ed_downerB ed_Size
- //#define REC_DELETE_AFTER_PARENTDIR 1
-
- #define REC_ERROR 1
- #define REC_FILEFOUND 2
- #define REC_DIRECTORYNAME 3
- #define REC_INIT 4
- #define REC_FINISHED 5
-
- struct BlockList {
- struct BlockList *next;
- struct ExAllData *upper; // für Rekursion
- ULONG BufSize;
- BPTR lock;
- struct ExAllData *ExAllData; // Wird während der Sortierung verändert
- struct ExAllData *ExAllDCopy; // Deshalb Kopie
- };
-
- class DirTree {
- int option;
- struct BlockList* root;
- char* pattern;
- char* directory;
- protected:
- struct BlockList *SearchRek(char *, char *, struct ExAllData *, int);
- void DeleteDirBlock(struct BlockList *);
- void DeleteAllBlocks(struct BlockList*, struct ExAllData *,int);
- struct BlockList *ReadDir(BPTR lock);
- //virtual void HookMethod(DirTree::rectype, char*, ExAllData*) {}
- virtual void Error(const char*) = 0;
- virtual void FileFound(const ExAllData*) = 0;
- virtual void DirChanged(const char*) = 0;
- virtual void Init() {}
- virtual void Finish() {}
- int running;
- public:
- DirTree(char *Dir, char *Pattern = "#?") {
- directory = Dir;
- pattern = new char[strlen(Pattern)*2+10];
- ParsePatternNoCase(Pattern, pattern,strlen(Pattern)*2+10);
- }
- void ReadRecursively() {
- Init();
- root = SearchRek(directory, pattern, NULL, 0);
- Finish();
- };
- ~DirTree() {
- if(root) DeleteAllBlocks(root, NULL, 0);
- delete[] pattern;
- };
- // int SetOptions(int options);
- };
-
-
-
-
-
-